package com.nervenets.web.controller.handler.user.user;

import com.nervenets.web.controller.handler.Handler;
import com.nervenets.web.entity.MessageCode;
import com.nervenets.web.hibernate.domain.user.User;

import javax.servlet.http.HttpServletRequest;

public class MobileCheckRegisteredHandler extends Handler<MobileCheckRegisteredParams> {
    @Override
    public String handle(MobileCheckRegisteredParams params, HttpServletRequest request) throws Exception {
        User userByMobile = userDao.getUserByMobile(params.getMobile());
        return null == userByMobile ? successMessage() : errorMessage(MessageCode.code_444, "该手机号码已经注册！");
    }

    @Override
    public String result() throws Exception {
        return successMessage();
    }
}
